<div class="panel panel-default" ng-controller="SaleCtrl">
	<div class="panel-heading">
		促销活动
	</div>
	<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
	<div class="row wrapper m-n">
		<form class="bs-example form-horizontal ng-pristine ng-valid">
			<div class="form-group col-md-4">
				<div class="col-md-11">
					<input type="text" ng-model="queryMap.subject" class="form-control" placeholder="主题">
				</div>
			</div>
 			<div class="form-group col-md-4" ng-show="flag">
				<div class="col-md-11">
					<div class="input-group">
						<ui-select ng-model="dplist.selected" theme="bootstrap">
						<ui-select-match placeholder="所属模块">{{$select.selected.name}}</ui-select-match>
						<ui-select-choices	repeat="dps in dplist | propsFilter: {name: $select.search}">
						<span ng-bind-html="dps.name | highlight: $select.search"></span>
						</ui-select-choices> </ui-select>
						<span class="input-group-btn">
							<button ng-click="dplist.selected = undefined"
								class="btn btn-default">
								<span class="glyphicon glyphicon-trash"></span>
							</button>
						</span>
					</div>
				</div>
			</div>
			<div class="form-group col-md-4">
				<div class="col-md-11">
					<button type="button" class="btn btn-info" ng-click="query()">查询</button>
				</div>
			</div>
		</form>
	</div>
	<div class="table-responsive">
		<table class="table table-striped b-t b-light">
			<thead>
				<tr>
					<th style="width:10px;">
						<label class="i-checks m-b-none" has-authority="BOOKING_SALE_DEL,RENT_SALE_DEL,BUS_SALE_DEL">
				<input type="checkbox"   ng-model="ckAll"  ng-click="checkAll(ckAll,dataList)" ><i></i>
			  </label>
					</th>
					<th style="width:100px;">活动主题</th>
					<th style="width:100px;">开始时间</th>
					<th style="width:100px;">结束时间</th>
					<th style="width:100px;">状态</th>
					<th style="width:100px;">所属模块</th>
					<th style="width:80px;">
						<div class="row list-icon">
							<a href tooltip="添加活动" has-authority="BOOKING_SALE_ADD,RENT_SALE_ADD,BUS_SALE_ADD"><i class="fa fa-plus fa-fw m-r-xs" ng-click="write('lg',null,'insert')"></i></a>
							<a href tooltip="批量删除" has-authority="BOOKING_SALE_DEL,RENT_SALE_DEL,BUS_SALE_DEL"><i class="fa fa-times fa-fw" ng-click="del('sm',sale,'deleteAll')" ></i></a>
						</div>
					</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="sale in dataList">
					<td>
						<label class="i-checks m-b-none" has-authority="BOOKING_SALE_DEL,RENT_SALE_DEL,BUS_SALE_DEL">
                            <input id="{{sale.ic}}" name="checks" type="checkbox" ng-checked="ckAll"
                                   ng-model="checks" ng-click="check(sale.id,checks)"><i></i>
                        </label>
                    </td>
					<td>{{sale.subject}}</td>
					<td>{{sale.startTime|date:"yyyy-MM-dd HH:mm:ss"}}</td>
					<td>{{sale.endTime|date:"yyyy-MM-dd HH:mm:ss"}}</td>
					<td>
						<span ng-if="sale.status==1">未激活</span>
						<span ng-if="sale.status==2">已激活</span>
						<span ng-if="sale.status==3">进行中</span>
						<span ng-if="sale.status==4">已结束</span>
					</td>
					<td>{{sale.moduleId | moduleFilter}}</td>
					<td>
						<div class="row list-icon">
							<a href tooltip="关联班次"  ng-show="sale.moduleId==1"  ui-sref="app.public.addSaleShift({saleId:sale.id,subject:sale.subject})"><i class="fa fa-edit" ></i></a>
							<a href tooltip="指定打折线路" ng-show="sale.moduleId==2" ui-sref="app.public.salesRoute({saleId:sale.id,subject:sale.subject})"> <i class="fa fa-edit"  ></i></a>
							<a href tooltip="关联班次档案"  ng-show="sale.moduleId==3" ui-sref="app.public.salesShiftTpl({saleId:sale.id,subject:sale.subject})"> <i class="fa fa-edit" ></i></a>
							<a href tooltip="修改" has-authority="BOOKING_SALE_UPDATE,RENT_SALE_UPDATE,BUS_SALE_UPDATE"><i class="fa fa-pencil fa-fw m-r-xs" ng-click="write('lg',sale,'update')" ></i></a>
							<a href tooltip="删除" has-authority="BOOKING_SALE_DEL,RENT_SALE_DEL,BUS_SALE_DEL"><i class="fa fa-times fa-fw" ng-click="del('sm',sale,'delete')" ></i></a>
						</div>
					</td>
				</tr>
				<tr ng-show="dataList==''">
					<td colspan="7" style="text-align: center;">暂无促销活动信息</td>
				</tr>
			</tbody>
		</table>
	</div>
	<page-footer/>
</div>